# 采购合同详情页

from dim_web_auto_test.page.login_page.login_page import LoginPage
from setting import *


class PurchaseContractDetailPage(LoginPage):
    def fill_basic_info(self):
        pass

    def goto_pc_detail_by_url(self, pc_no="PC211221004"):
        """
        通过 url 跳转到指定合同的详情页面
        :return:
        """
        self.goto_page_by_url(SIT_PURCHASE_CONTRACT_DETAIL_URL.format(pc_no))

    def copy_purchase_contract(self):
        """
        复制采购合同
        :return:
        """
        btn_elements = self.find_elements("pc_detail_page.detail_page_btn")
        btn_elements[2].click()
        self.click("pc_detail_page.copy_confirm_btn")

    def create_and_save_purchase_contract(self):
        self.click("pc_detail_page.save_btn")
        self.click("pc_detail_page.goon_confirm_btn")
        self.click("pc_detail_page.commit_btn")
        self.click("pc_detail_page.commit_confirm_btn")
        self.click("pc_detail_page.goon_confirm_btn")
        self.click("pc_detail_page.edit_btn")
        self.click("pc_detail_page.approved_btn")
        self.click("pc_detail_page.commit_confirm_btn")
